<?php
class UploadTest extends CI_Controller {

	function uploadTest()
	{
		parent::__construct();
		$this->load->library('session');
		$this->load->library('form_validation');
		$this->load->library('encrypt');
                $this->load->model('mmaster');
                $this->load->model('mglobal');
		#$this->is_logged_in();
		#$this->mjadwal->saveLog();
	}

	function index()
    {
        
        $this->load->view('uploadTest_view');
            
    }
    
    function insert()
    {
            $config['upload_path'] = FCPATH.'file/Gallery';
            $config['allowed_types'] = 'gif|jpg|png|pdf|jpeg|doc';
            $config['max_size']	= '1000000';
            $config['max_width']  = '20000';
            $config['max_height']  = '20000';
            
            $result_array = array();

            $this->load->library('upload', $config);

            if(!empty($_FILES['userfile']['name']))
				{

				    if(!$this->upload->do_upload('userfile'))
					{
                        $error = array('error' => $this->upload->display_errors());
                        print_r($error);
                        //$this->upload->display_errors('<p>', '</p>');
                    }
                    else
                    {
			             array_push($result_array,$this->upload->data());
                    }
                }
            else
            {
                echo 'tse';    
            }
    }    
    
 }